Code
graph <- create_graph() %>%
add_node(label="Node A") %>%
add_node(label = " I have a\nhyperlink") %>%
add_edge(from = 1, to = 2) %>%
select_last_nodes_created() %>%
set_node_attrs_ws(node_attr = URL, value = "https://nrk.no") %>%
add_node(label = "Looooooooooooooooooooong name", from = 1, to = 2) %>%
set_node_attrs(node_attr = shape, values = "box") %>%
select_nodes_by_id(nodes = 3) %>%
set_node_attrs_ws(node_attr = shape, value = "rectangle")
# Export the graph to a PNG file
export_graph(graph, file_name = "graph.png", width = 400, height = 400)
# Include the PNG file in your HTML document
include_graphics("graph.png")